import request from '@/utils/request';

/*  获取角色列表的接口 */
export const fetchRoleListAPI = () => {
  return request({
    url: '/park/sys/role',
    method: 'GET',
  });
};

/* 删除角色的接口 */
export const deleteRoleAPI = (roleId) => {
  return request({
    url: `/park/sys/role/${roleId}`,
    method: 'DELETE',
  });
};

/* 获取所有权限的接口 */
export const fetchAllPermisionAPI = () => {
  return request({
    url: '/park/sys/permision/all/tree',
    method: 'GET',
  });
};

/* 查询当前角色拥有的权限接口 */
export const findRolePermisionAPI = (roleId) => {
  return request({
    url: `/park/sys/role/${roleId}`,
    method: 'GET',
  });
};

/* 查询当前角色拥有的成员接口 */
export const findRoleEmplyeesAPI = ({ pageParams, roleId }) => {
  return request({
    url: `/park/sys/roleUser/${roleId}`,
    method: 'GET',
    params: pageParams,
  });
};

/* 添加角色 */
export const addRoleAPI = (data) => {
  return request({
    url: '/park/sys/role',
    method: 'POST',
    data,
  });
};
/* 编辑角色 */
export const editRoleAPI = (data) => {
  return request({
    url: '/park/sys/role',
    method: 'PUT',
    data,
  })
}
